package com.zyht.bank.manage.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.pagehelper.PageHelper;
import com.zyht.bank.entity.AxdCertificateNotices;
import com.zyht.bank.service.AxdCertificateNoticesService;
import com.zyht.common.AbsPrintBaseController;
import com.zyht.common.bean.PropertiesUtilBean.PropertiesUtils;
import com.zyht.common.util.Page;

@Controller
@RequestMapping("admin/certficateNotices")	
public class AdminCertificateNotices extends AbsPrintBaseController {
	
	private String BASEPATH = "/banks/manage/certficateNotices/";
	
	@Resource
	private AxdCertificateNoticesService  axdCertificateNoticesService;
	@RequestMapping("index")	
	public String index(Model model, Integer currentPage, String custName,String startTime,String endTime) {
		 
		  int total=  axdCertificateNoticesService.findaxdCertificateNoticesCount(custName);
		  if(null == currentPage || currentPage == 0 ){
				  currentPage = 1;
			  }
		  
		      
			  String pageSizeStr = PropertiesUtils.getConfig("paganation_page_size");
			  int pageSize = Integer.valueOf(pageSizeStr);
			  Page<AxdCertificateNotices> page = new Page<AxdCertificateNotices>(total,currentPage,pageSize);
			  PageHelper.startPage(currentPage, pageSize);
			  List<AxdCertificateNotices> axdOrgInfoList = axdCertificateNoticesService.findaxdCertificateNotices(custName);
			  page.setRecordList(axdOrgInfoList);
			  model.addAttribute("page",page);
			  model.addAttribute("custName",custName);
		      return makeView("index");

	}
	

	private String makeView(String path) {
		return BASEPATH.concat(path);
	}

	
}
